package com.czk.auto;

import com.czk.bean.HelloProperties;
import com.czk.service.HelloService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/7/5 23:13
 */
@Configuration
@EnableConfigurationProperties(HelloProperties.class) // 默认将其放入容器中然后注入早HelloService
@ConditionalOnMissingBean(HelloService.class)
public class HelloServiceAutoConfiguration {
    @Bean
    public HelloService helloService(){
        return new HelloService();
    }
}
